$(function() {
    var body = $('body');
    $('div.main-container').on({
        click: function() {
            var hideWindow = $('div.hide-window-click');
            if (hideWindow.length) {
                if (hideWindow.is(':visible')) {
                    hideWindow.hide().removeClass('active').parent().removeClass('active')
                }
            }
        }
    })
    var width = $(window).width();
    var height = $(window).height();
    var is_mobile = false;

    function detectmob() {
        if (window.innerWidth <= 800 && window.innerHeight <= 600) {
            $('html').addClass('mobile');
            is_mobile = true;
            return true;
        } else {
            return false;
        }
    }





    if ($('#wysiwyg').length) {
        CKEDITOR.replace('wysiwyg');
//        $('.edit_inline').on({
//            click: function() {
//                var $nid = $(this).data('nid');
//                var $type = $(this).data('type');
//                window.location.href = 'member/' + $type + '/edit/' + $nid;
//            }
//        })
    }

    if ($('div.open-container').length) {
        $.each($('div.open-container'), function(index, element) {
            var $element = $(element);
            var hideValue = $element.data('hide');

            var $container = $element.data('container');
            var $containerO = $($container);

            var $hidecontainer = $containerO.find(hideValue);
            var $containerHeight = $hidecontainer.height();
            $hidecontainer.css({display: 'none'})


            $(element).on('click', function() {
                if ($containerO.hasClass('opened')) {
//close
                    $containerO.animate({
                        height: '0px'
                    }).removeClass('opened')

                    if ($hidecontainer.length) {
                        $hidecontainer.css({display: 'none'})
                    }
                } else {
                    //open container

                    if ($hidecontainer.length) {
                        $hidecontainer.css({display: 'block'})
                    }

                    $containerO.animate({
                        height: $containerHeight
                    }).addClass('opened')


                }
            })
        })

    }



    if ($('img[attr="data-cke-saved-src"]').length) {
        $('img[attr="data-cke-saved-src"]').removeAttr('data-cke-saved-src')
    }

    if ($('.crop-area').length) {
        $.getScript('addons/shared_addons/themes/initializr/js/jcrop/jquery.Jcrop.min.js')
                .done(function() {
            var $cropArea = $('.crop-area');
            var $cropAreaImage = $('#crop-image');
            var $cropAreaParams = $cropArea.data('params');
            if ($cropAreaParams.image_height > $cropAreaParams.image_width) {
                var cropsize = $cropAreaParams.image_width;
            }

            if ($cropAreaParams.image_height < $cropAreaParams.image_width)
            {
                var cropsize = $cropAreaParams.image_height;
            }
            var croppedCoords;
            function showCoords(c)
            {
                croppedCoords = c;
            }
            ;
            $('.send-crop').on({
                click: function() {
                    $.extend(croppedCoords, $cropAreaParams);
                    croppedCoords.status = 'sendCropped';
                    $.ajax({
                        type: 'POST',
                        dataType: 'json',
                        data: (croppedCoords) ? croppedCoords : null,
                        url: 'member/profile/change_picture',
                        success: function(data) {
                            if (data.status === 1) {
                                location.href = data.callback
                            }

                        }
                    })
                }
            })

            $cropAreaImage.Jcrop({
                allowMove: true,
                allowResize: false,
                onChange: showCoords,
                setSelect: [cropsize, cropsize, 0, 0],
                trueSize: [$cropAreaParams.image_width, $cropAreaParams.image_height]
            });
        })


    }

    if ($('#editable').length) {
//        CKEDITOR.replace('body');
// Turn off automatic editor creation first.
        CKEDITOR.disableAutoInline = true;
        CKEDITOR.inline('editable',
                {on:
                            {
                                instanceReady: function(ev)
                                {
                                    // Output paragraphs as <p>Text</p>.
                                    this.dataProcessor.writer.setRules('p',
                                            {
                                                indent: false,
                                                breakBeforeOpen: true,
                                                breakAfterOpen: false,
                                                breakBeforeClose: false,
                                                breakAfterClose: true
                                            });
                                }
                            }}
        );

        $('.save_node').on({
            click: function() {
                var nid = $('.input-title').data('nid')
                var dataHtml = CKEDITOR.instances.editable.getData();
                var $data = {
                    url: 'edit/' + nid,
                    title: $('.input-title').html(),
                    body: dataHtml,
                    submit: 'submit'
                }
                Send.node($data);
            }
        })

        var $html = $('#editable').html();
        $('.reset_node').on({
            click: function() {
                $('#editable').html($html);
            }
        })
        $('.edit_html').on({
            click: function() {
                var $nid = $(this).data('nid');
                window.location.href = 'member/cipta/edit_html/' + $nid;
            }
        })


    }
    var $formAjaxForm = $('form.ajax-form');
    if ($formAjaxForm.length) {
        var $error = $formAjaxForm.find('div.alert-error').empty();
        var $success = $formAjaxForm.find('div.alert-success').empty();
        var ajaxFormOptions = {
            type: 'post',
            beforeSubmit: function() {
                var valid = true;
                $.each($formAjaxForm.find('.required'), function(index, element) {
                    if ($(element).val().length == 0) {
                        $error.html('Harap form diisi semua');
                        $success.html('');
                        valid = false;
                        return false;
                    }

                })
                return valid;
                $formAjaxForm.find('input[name=submit]').addClass('disabled');
            }, // pre-submit callback 
            success: function() {

                $formAjaxForm.find('input[name=submit]').removeClass('disabled');
                var successMsg = ($formAjaxForm.data('successmsg') || 'Berhasil');
                $formAjaxForm.find('input[type=text],textarea').val('');
                $error.html('');
                $success.html(successMsg);
            },
            error: function() {
                var errorMsg = ($formAjaxForm.data('errormsg') || 'Error');
                $error.empty().html(errorMsg);
            }

            // post-submit callback 

            // other available options: 
            //url:       url         // override for form's 'action' attribute 
            //type:      type        // 'get' or 'post', override for form's 'method' attribute 
            //dataType:  null        // 'xml', 'script', or 'json' (expected server response type) 
            //clearForm: true        // clear all form fields after successful submit 
            //resetForm: true        // reset the form after successful submit 

            // $.ajax options can be used here too, for example: 
            //timeout:   3000 
        };

        $('form.ajax-form').ajaxForm(ajaxFormOptions)
    }

    $('.ajax-input-checkbox').on({
        change: function() {
            var $this = $(this);
            var $data = $this.data(), inputName = $this.attr('name'),
                    inputData = {};
            inputData[inputName] = ($this.is(':checked')) ? 'on' : 'off';
            $.extend($data, inputData);
            eval('Send.' + $data.category)($data);
        }
    });
    var send = {};
    send.node = function(data) {
        var $data = data;
        $.ajax({
            url: 'member/cipta/' + data.url,
            type: 'POST',
            data: $data,
        });
    };

    var loading = {selector: '.loading-bottom'};
    loading.show = function() {
        $(this.selector).animate({'opacity': 1}, 600)
    }
    loading.hide = function() {
        $(this.selector).animate({'opacity': 0}, 600)
    }
    /**===================================================================== INITIALIZATION*/
    //for IE < 9 { Object.create } support
    if (Object.create) {
        var Send = Object.create(send);
        var LoadingBottom = Object.create(loading);
    }
    else {

        Object.build = function(o) {
            var initArgs = Array.prototype.slice.call(arguments, 1);
            function F() {
                if ((typeof o.init === 'function') && initArgs.length) {
                    o.init.apply(this, initArgs);
                }
            }
            F.prototype = o;
            return new F();
        };
        var Send = Object.build(send);
        var LoadingBottom = Object.build(loading);
    }

    if ($('.paging-list').length) {
        var prev = {start: 0, stop: 0},
        list = $('.paging-list').children();
        if (list.length > 1) {

            $('.pagenumber').on({
                click: function(e) {
                    e.preventDefault();
                }
            })

            $(".paging").paging(list.length, {
                format: '[ < ncnnnnnn > ]',
                perpage: 1,
                lapping: 0,
                onSelect: function(page) {
                    // add code which gets executed when user selects a page
                    var pageListPosition = $(".paging-list").position();
                    body.animate({scrollTop: pageListPosition.top}, 600);
                    var data = this.slice;
                    list.slice(prev[0], prev[1]).css('display', 'none');
                    list.slice(data[0], data[1]).fadeIn("slow");
                    prev = data;
                    $('.pagenumber').removeClass('currentpage');
                    $('.pagenumber[data-page=' + page + ']').addClass('currentpage');

                },
                onFormat: function(type) {
                    switch (type) {
                        case 'block': // n and c
                            return '<a class="pagenumber">' + this.value + '</a>';
                        case 'next': // >
                            return '<a class="pagenext">&gt;</a>';
                        case 'prev': // <
                            return '<a class="pageprev">&lt;</a>';
                        case 'first': // [
                            return '<a>awal</a>';
                        case 'last': // ]
                            return '<a>akhir</a>';
                    }
                }
            });
            body.keydown(function(e) {
                if (e.keyCode == 37) { // left

                    $('.pageprev').click();
                }
                else if (e.keyCode == 39) { // right
                    $('.pagenext').click();
                }
//                    console.log(e.keyCode);
            });


        }
    }

    if ($('.scroll-container').length) {
        var screenheight = screen.height
                , scrollContainerHeight = screenheight / 3;

        $.each($('.scroll-container'), function() {
            var $this = $(this);
            $this.perfectScrollbar({wheelSpeed: 40})
            var scrollContentHeight = $this.find('div.scroll-content').height();
            if (scrollContentHeight > 0) {
                //if scroll content less than scollContainerHeight then wrap tight
                if (scrollContentHeight < scrollContainerHeight) {
                    $this.height(scrollContentHeight);
                } else {
                    $this.height(scrollContainerHeight);
                }

            }
        })
    }

    if ($('.timepicker').length) {
        $('.timepicker').timepicker({'timeFormat': 'H:i'});
    }
    if ($('.datepicker').length) {
        $.getScript('addons/shared_addons/themes/initializr/js/bootstrap-datepicker.js')
                .done(function() {
            $('.datepicker').datepicker({
                format: 'yyyy-mm-dd'
            });
        })

    }

    if ($('.full-calendar').length) {

        var $event = $('.full-calendar').data('events');
//            console.log($event);
        $calendar = $('.full-calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            monthNames: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'],
            dayNames: ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'],
            dayNamesShort: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            buttonText: {
                today: 'Sekarang',
                month: 'bulan',
                week: 'minggu',
                day: 'hari'
            },
            events: $event,
            dayClick: function() {

            },
            eventRender: function(event, element) {
                element.popover({
                    title: event.title,
                    content: event.notes,
                    html: true,
                    placement: 'top'
                });
            },
            eventClick: function(calEvent, jsEvent, view) {

            }
        });
        $('.fc-event').on('click', function() {
            $('.fc-event').not(this).popover('hide')
        })

    }

    if ($('.corner-box').length) {

        var changeCorner = (
                function() {
                    var changecorner = function() {
                        $('.corner-box').corner("bevel tr bl 20px");
                    };
                    changecorner();
                    return changecorner;
                }()
                );
    }
    if ($('div.circle-box').length) {

        var changeCircle = (
                function() {
                    var changecircle = function() {
                        var cicle = $('div.circle-box');
                        var cornerSize = cicle.height() * 2;
                        cicle.corner(cornerSize + 'px');
                    };
                    changecircle();
                    return changecircle;
                }()
                );
    }

    if ($('div.scroll-top').length) {
        $(window).scroll(function() {
            var minShow = $('div.right-side').height();
            if ($(this).scrollTop() > minShow) {
                $('.scroll-top').fadeIn();
            } else {
                $('.scroll-top').fadeOut();
            }
        });
        $('.scroll-top').click(function() {
            $("html, body").animate({scrollTop: 0}, 900);
            return false;
        });
    }
    if ($('ul.infinitescroll').length) {
        var bufferpx = '1000'
        $.each($('ul.infinitescroll'), function(index, element) {
            var $this = $(this)
                    , state,
                    loadmore = $this.parent().find('.loadmore')
                    ,
                    $window = $(window);

            var loadmorePosition = function() {
                var $position = loadmore.position();
                return ($position.top - bufferpx);
            }
//                
            $window.scroll(function() {
                var $scrollPosition = $window.scrollTop()
                var $endScroll = loadmorePosition();

                if ($scrollPosition >= $endScroll) {
                    if (state !== 'end') {
                        state = 'end';
                        //trigger button
                        $.when(loadmore.trigger('click')).done(function() {
//if loaded change state    
                            state = 'startOver'
                        })

                    }
                }
            });
        })
    }

    if ($('.corner-box-reverse').length) {

        var changeCornerReverse = (
                function() {
                    var changecorner = function() {
                        $('.corner-box-reverse').corner("bevel tl br 20px");
                    };
                    changecorner();
                    return changecorner;
                }()
                );
    }

    if ($('div.corner-box-lefttop').length) {
        $('div.corner-box-lefttop').corner("bevel tl 20px");
    }
    var masonrySelector = $('ul.masonry');
    if (masonrySelector.length) {
        var bindMasonry = (
                function() {
                    var bindmasonry = function() {
                        var columnWidth = masonrySelector.height();
                        masonrySelector.imagesLoaded(function() {
                            var $item = $('.masonry-item');
                            var $multiplieer = 0.05;

                            if ($item.hasClass('span6')) {
                                $multiplieer = 0.02;
                            }

                            if ($item.data('gutterplier')) {
                                $multiplieer = $item.data('gutterplier');
                            }


                            var gutter = $item.width() * $multiplieer;

                            masonrySelector.masonry({
                                // options
                                itemSelector: '.masonry-item',
                                gutterWidth: gutter
                            });
                        })
                    };
                    bindmasonry();
                    return bindmasonry;
                }()
                );



    }

    $('.donker-box.popdown').on({
        click: function() {
            var $child = $(this).find('.donker-box-child');
            if ($child.hasClass('active')) {
                $.when($child.animate({
                    opacity: 0, easing: 'easeInCirc', duration: 1000
                })).done($child.css({display: 'none'}));
                $child.removeClass('active');
                $child.parent('.donker-box').removeClass('active');
            } else {
                $.when($child.animate({
                    opacity: 1, easing: 'easeInCirc', duration: 1000
                })).done($child.css({display: 'block'}));
                $child.addClass('active');
                $child.parent('.donker-box').addClass('active');
            }
            $child.on({click: function() {
                    return false;
                }});
        }


    })

    if ($('.check-title').length) {
        $('.check-title').on({
            blur: function() {
                var $this = $(this),
                        title = $this.val();
                $.ajax({
                    url: 'member/cipta/check_title',
                    data: {
                        title: title
                    },
                    type: 'POST',
                    success: function(data) {
                        $('.title-alert').empty().append(data);
                    }
                })

            }
        })
    }

    if ($('#sharrre').length) {

        $('#shareme').sharrre({
            share: {
                twitter: true,
                facebook: true
            },
            template: '<div class="box"><div class="left">Bagikan</div><div class="middle"><a class="facebook">f</a><a class="twitter">t</a></div><div class="right">{total}</div></div>',
            enableHover: false,
            enableTracking: true,
            buttons: {twitter: {via: 'mediasastra'}},
            render: function(api, options) {
                $(api.element).on('click', '.twitter', function() {
                    api.openPopup('twitter');
                });
                $(api.element).on('click', '.facebook', function() {
                    api.openPopup('facebook');
                });
            },
        })


    }

    if ($('.select2').length) {

        var loadingImg = function() {
            var selector = $('div.loading-img');
            if (selector.hasClass('visible')) {
                selector.animate({opacity: 0}).removeClass('visible');
            } else {
                selector.animate({opacity: 1}).addClass('visible');

            }
        }

        $('.select2').select2();
        $('.select2.page').on({
            change: function() {
                var $this = $(this);
                var val = $this.val();
                $.ajax({
                    url: val,
                    beforeSend: function() {
                        loadingImg();
                    },
                    success: function(html) {
                        var newData = $(html).find('.content_lists li');

                        if (newData.length) {
                            var newParams = $(html).find('.loadmore').data('params');
                            $('.loadmore').data('params', newParams).removeClass('disabled').html('Muat lainnya');
                            loadingImg();
                        } else {
                            newData = '<div class="alert">Tidak tersedia</div>'
                        }

                        $.when($('.content_main').empty().html(newData)).done(function() {
                            panContainer();
                            facebookCount();
                            FB.XFBML.parse();
                            masonrySelector.imagesLoaded(function() {
                                masonrySelector.masonry('reload')
                            })
                        })
                    }
                })
            }
        })
        $('.select2.filter').on({
            change: function() {

                var $this = $(this),
                        selectPage = $('.select2.page'),
                        page = (selectPage.length) ? selectPage.val() : body.attr('class');
                var string = $this.val();
                $.ajax({
                    url: page + '?' + string + '=TRUE',
                    beforeSend: function() {
                        loadingImg();
                    },
                    success: function(html) {
                        var newData = $(html).find('.content_lists li');
                        var newParams = $(html).find('.loadmore').data('params');
                        $('.loadmore').data('params', newParams).removeClass('disabled').html('Muat lainnya');
                        $.when($('.content_main').empty().html(newData)).done(function() {
                            panContainer();
                            masonrySelector.imagesLoaded(function() {
                                masonrySelector.masonry('reload')
                                FB.XFBML.parse();
                                facebookCount();
                            })
                            loadingImg();
                        })
                    }
                })
            }
        })


    }


    if ($('.autocompletetag').length)
    {
        var tagsUrl;
        $.ajax({
            url: 'member/ajax/users',
            success: function(data) {
                tagsUrl = data;
            }
        }).done(function() {
            $.each($('.autocompletetag'), function(index, element) {
                $(element).tagbox({
                    url: tagsUrl,
                    lowercase: false
                });
            })
        })
    }
    if ($('.loadmore').length)
    {
        $.each($('.loadmore'), function(index, element) {

            var $this = $(this);
            $this.on({
                click: function() {
                    if (!$this.hasClass('disabled')) {
                        var params = $(this).data('params');
                        $.ajax({
                            type: 'POST',
                            url: params.type,
                            data: params,
                            beforeSend: function() {
                                $this.addClass('disabled').html('Sedang memuat...');
                                LoadingBottom.show();
                            }
                            , success: function(html) {
                                var newData = $(html).find('.content_lists li').css({opacity: 0});
                                if (newData.length) {
                                    //append new data
                                    var appendData = function(data) {

                                        if ($this.parent().find('.masonry').length) {
                                            $this.addClass('disabled')
                                            masonrySelector.append(data).imagesLoaded(function() {
                                                $(this).masonry('appended', data, true).removeClass('disabled');
                                                $this.parent().find('.content_main li').animate({opacity: 1}, 800);
                                                LoadingBottom.hide()
                                            });
                                        } else {
                                            $this.parent().find('.content_main').append(data)
                                            $this.parent().find('.content_main li').animate({opacity: 1}, 800)
                                        }
                                    }
                                    $.when(
                                            appendData(newData)
                                            ).done(
                                            function() {
                                                var newParams = $(html).find('.loadmore').data('params');
                                                $this.data('params', newParams).removeClass('disabled').html('Muat lainnya');
                                                twttr.widgets.load();
                                                FB.XFBML.parse();
                                                facebookCount();
                                                panContainer();
                                            })
                                } else {
                                    $this.html('Habis');
                                    LoadingBottom.hide()
                                }
                            }
                        })
                    }
                }
            })
        })

    }

    if ($('.facebook-count').length) {
        var facebookCount = function() {

            $.each($('.facebook-count'), function(index, e) {
                var $this = $(e)
                if (!$this.hasClass('parsed')) {
                    var $thisUrl = $this.data('url');
                    // Get Number of Facebook Shares
                    $.getJSON('http://graph.facebook.com/' + $thisUrl,
                            function(data) {
                                $this.append('<b>' + (data.shares || 0) + '</b>').addClass('parsed');
                            });
                }
            })
        }

        facebookCount();
    }




    if ($('.pan-container.pan-enable').length) {
        var panContainer = function() {

            $.each($('.pan-container.pan-enable'), function(index, element) {
                var $this = $(this),
                        $panArea = $this.find('.pan-area');
                $panArea.css({position: 'absolute'})
                //find top margin to crop
                var $top = ($panArea.height() - $this.height()) / 4;
                $panArea.css({top: '-' + $top + 'px'});
            })
        }
        panContainer();
    }

    if (($('.stickybar').length > 0) && (is_mobile === false)) {
        $.each($('.stickybar'), function() {
            var $this = $(this);
            var stickywidth = $this.width();
            var $css = {width: stickywidth}
            if ($this.data('css')) {
                $.extend($css, $this.data('css'))
            }
            var $callback = {
                defaultCallback: function() {
                    $.when($('.stickynav').animate({opacity: 0}, 500))
                            .done(function() {
                        $('.stickynav').animate('width', 0);
                    })
                            .done(function() {
                        $('.stickynav').css('display', 'none');
                    })
                            .done(function() {
                        $('.nonstickynav').css('display', 'block');
                    })
                            .done(function() {
                        $('.nonstickynav').animate({opacity: 1});
                    })
                }
                ,
                callback: function() {
                    $.when($('.nonstickynav').css({display: 'none', opacity: 0}))
                            .done($('.stickynav').css('display', 'block'))
                            .done(function() {
                        $('.stickynav').animate({opacity: 1}, 500)
                    })
                            .done(function() {
                        $('.stickynav').animate('width', 'auto');
                    })
                }
            }
            $this.sticky($callback).css($css)
        })
    }



    var $modaltrigger = $('#modaltrigger')
    if ($modaltrigger.length) {
        $modaltrigger.leanModal({overlay: 0.4});
        $('#modalfeedback').find('input[type=submit]').on({
            click: function() {
                $('#lean_overlay').trigger('click');
            }
        })
    }

    var $sharebutton = $('div.share-button');

    if ($sharebutton.length) {
        
        body.on('click', 'div.share-button', function(event) {
            var $this = $(event.currentTarget);
            var $thisShareContainer = $this.parent().find('div.share-container');
            var $thisShareContainerHeight = $thisShareContainer.height()*2
            var $shareitem = $thisShareContainer.find('.share-item');
            if ($this.hasClass('clicked')) {
//                nextContainer.animate({marginTop: '0px', });
                $thisShareContainer.next().animate({marginTop: 0})
                $shareitem.animate({'opacity': 0,easing: 'easeInQuad'}).css({display: 'none'})
                $this.removeClass('clicked');
            } else {
                $thisShareContainer.next().animate({marginTop: $thisShareContainerHeight})
                $this.addClass('clicked');
                $shareitem.css({display: 'block'}).animate({'opacity': 1})
            }
        })
    }

    if ($('#rss-feeds').length) {
        $.getScript('addons/shared_addons/themes/initializr/js/jquery.rss.min.js')
                .done(function() {

            $.each($(".rss-feeds-items"), function(index, element) {

                var $element = $(element),
                        $feedUrl = $element.data('urlrss');

                $element.rss(
                        $feedUrl,
                        {
// how many entries do you want?
// default: 4
// valid values: any integer
                            limit: 5,
                            // will request the API via https
                            // default: false
                            // valid values: false, true
                            ssl: false,
                            // outer template for the html transformation
                            // default: "<ul>{entries}</ul>"
                            // valid values: any string

                            // inner template for each entry
                            // default: '<li><a href="{url}">[{author}@{date}] {title}</a><br/>{shortBodyPlain}</li>'
                            // valid values: any string
                            entryTemplate: '<li><a href="{url}" target="_blank">{title}</a><br/>{shortBodyPlain}<br/><div class="metadata">{date}</div></li>',
                            tokens: {
                            },
                            // output mode of google feed loader request
                            // default: 'json'
                            // valid values: 'json', 'json_xml'
                            outputMode: 'json_xml',
                            // the effect, which is used to let the entries appear
                            // default: 'show'
                            // valid values: 'show', 'slide', 'slideFast', 'slideSynced', 'slideFastSynced'
                            effect: 'slideFastSynced',
                            // a callback, which gets triggered when an error occures
                            // default: function() { throw new Error("jQuery RSS: url don't link to RSS-Feed") }
                            error: function() {
                            },
                            // a callback, which gets triggered when everything was loaded successfully
                            // this is an alternative to the next parameter (callback function)
                            // default: function(){}
                            success: function() {
                            }
                        },
                // callback function
                // called after feeds are successfully loaded and after animations are done
                function callback() {
                }
                )//

            })//each
        })//done
    }
})

